﻿@page
@model EventsModel
@inject PluginContext pluginContext 
@{
    Layout = "_BasicLayout";
    ViewBag.Title = "Events";
    dynamic dict = Locale.GetDictionary("Scada.Web.Plugins.PlgMain.Areas.Main.Pages.Events");

    string GetInfo()
    {
        return string.Format(dict.EventInfo, pluginContext.Options.EventCount, pluginContext.Options.EventDepth * 24);
    }
}

@section Styles {
    <link href="~/plugins/Main/css/events.min.css" rel="stylesheet" asp-append-version="true" />
}

@section Scripts {
    <script src="~/js/view-hub.js" asp-append-version="true"></script>
    <script src="~/plugins/Main/js/main-api.js" asp-append-version="true"></script>
    <script src="~/plugins/Main/js/table-common.js" asp-append-version="true"></script>
    <script src="~/plugins/Main/js/events.js" asp-append-version="true"></script>
    <script>
        archiveBit = @Model.ArchiveBit;
        pluginOptions = @pluginContext.Options.ToJs();
        phrases = @WebUtils.DictionaryToJs("Scada.Web.Plugins.PlgMain.Areas.Main.Pages.Events.Js");
    </script>
}

<div id="divToolbar" class="toolbar">@*
    *@<span class="toolbar-group">@*
        *@<span id="spanAllEventsBtn" class="tool-btn">@dict.spanAllEventsBtn</span>@*
        *@<span id="spanEventsByViewBtn" class="tool-btn">@dict.spanEventsByViewBtn</span>@*
        *@<span id="spanPrintBtn" class="tool-btn" data-bs-toggle="tooltip" data-bs-placement="bottom" title="@dict.spanPrintBtn_ToolTip"><i class="fa-solid fa-print"></i></span>@*
        *@<span id="spanInfoBtn" class="tool-btn" data-bs-toggle="tooltip" data-bs-placement="bottom" title="@GetInfo()"><i class="fa-solid fa-circle-info"></i></span></span>@*
    *@<span id="spanErrorBadge" class="badge bg-danger hidden">@dict.spanErrorBadge</span>
</div>
<div id="divTableWrapper" class="table-wrapper hidden">
    <table id="tblEvents" class="table-main">
        <thead>
            <tr>
                <th>@dict.TimeCol</th>
                <th>@dict.ObjCol</th>
                <th>@dict.DevCol</th>
                <th>@dict.CnlCol</th>
                <th>@dict.DescrCol</th>
                <th>@dict.SevCol</th>
                <th>@dict.AckCol</th>
            </tr>
        </thead>
    </table>
</div>
<div id="divMessage" class="box-center fs-2 text-secondary"></div>
<audio id="audEvent" preload="auto" src="~/plugins/Main/sounds/event-beep.mp3" />
